package com.example.springsecuritydemo.controller;

import com.example.springsecuritydemo.ResponseResult;
import com.example.springsecuritydemo.User;
import com.example.springsecuritydemo.service.LoginService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author gaoxiaoqi
 * @Date 2023/3/3 16:01
 */
@RestController
public class LoginController {


    @Resource
    private LoginService loginService;

    @PostMapping("/user/login")
    public ResponseResult login(@RequestBody User user){

        return loginService.login(user);
    }

    @PostMapping("/user/logout")
    public ResponseResult logout(){
        return loginService.logout();
    }


}
